import request from "@/http/request/index.js";

export function tokenReloadRequest(data) {
  return request({
    url: "/reloadToken",
    method: "post",
    data: {
      username: localStorage.getItem("username"),
      password: localStorage.getItem("password"),
    },
  });
}
// 登录
export function login(data) {
  return request({
    url: "/login",
    method: "post",
    data,
  });
}
// 获取基本信息
export function getInfo(data) {
  return request({
    url: "/getInfo",
    method: "post",
    data,
  });
}
// 获取首页信息
export function getHomeInfo() {
  return request({
    url: "/getHomeInfo",
    method: "get"
  });
}
// 区域的
export function getOrigin(data) {
  return request({
    url: "/getOrigin",
    method: "post",
    data,
  });
}
export function addUpdateOrigin(data) {
  return request({
    url: "/addUpdateOrigin",
    method: "post",
    data,
  });
}
export function delOrigin(data) {
  return request({
    url: "/delOrigin",
    method: "post",
    data,
  });
}
// 权限的
export function getRole(data) {
  return request({
    url: "/getRole",
    method: "post",
    data,
  });
}
export function getRoleAll() {
  return request({
    url: "/getRoleAll",
    method: "get"
  });
}
export function addUpdateRole(data) {
  return request({
    url: "/addUpdateRole",
    method: "post",
    data,
  });
}
export function delRole(data) {
  return request({
    url: "/delRole",
    method: "post",
    data,
  });
}
// 用户的
export function getUser(data) {
  return request({
    url: "/getUser",
    method: "post",
    data,
  });
}
export function addUpdateUser(data) {
  return request({
    url: "/addUpdateUser",
    method: "post",
    data,
  });
}
export function delUser(data) {
  return request({
    url: "/delUser",
    method: "post",
    data,
  });
}

// 配置修改 - 可批量
export function updateConfig(data) {
  return request({
    url: "/updateConfig",
    method: "post",
    data,
  });
}

// 上传文件
export function fileUpload(data) {
  return request({
    url: "/upload",
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data,
  });
}


// 获取日志
export function getLog(data) {
  return request({
    url: "/getLog",
    method: "post",
    data,
  });
}